﻿using Framework.Poco;
using Shell.DomainDot;
using System;

namespace Framework.Domain
{
    /// <summary>
    /// 文章分类创建器
    /// </summary>
    public class CreateCategory : DomainDotBase
    {
        /// <summary>
        /// 所有的文章分类
        /// </summary>
        public WithAll<Category> Categories { get; set; }

        /// <summary>
        /// 创建分类
        /// </summary>
        public void Create(Category instance)
        {
            var entity = this.Categories.Create();
            PocoUtils.AssignProperty<Category>(instance, entity, typeof(Guid));
            this.Categories.Submit();
        }
    }
}
